package com.zhentao.product.controller;

import com.zhentao.model.entity.product.Category;
import com.zhentao.model.vo.common.Result;
import com.zhentao.model.vo.common.ResultCodeEnum;
import com.zhentao.product.service.CategoryService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.v3.oas.annotations.Operation;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import java.util.List;

@Api("商品分类接口")
@RestController
@RequestMapping(value="/api/product/category")
@SuppressWarnings({"unchecked","rawtypes"})
public class CategoryController {

    @Resource
    private CategoryService categoryService;

    @ApiOperation(value = "获取分类树形数据")
    public Result<List<Category>> findOneCategory() {
        List<Category> list = categoryService.findCategoryTree();
        return Result.build(list, ResultCodeEnum.SUCCESS);
    }
}
